{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">昵称：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="user_username" lay-verify="required">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">用户备注：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="user_remark">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">手机号：</label>
                            <div class="layui-input-block">
                                <input type="tel" class="layui-input" name="user_phone" lay-verify="required">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">头像：</label>
                            <input type="hidden" name="user_image" id="lay-img" lay-verify="image">
                            <div class="layui-input-block">
                                <div id="lay-upload">上传图片</div>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览图：
                                    <div class="layui-upload-list" id="lay-list">
                                    </div>
                                </blockquote>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">用户身份：</label>
                            <div class="layui-input-block">
                                <select name="user_d_type" lay-search="" lay-filter="types">
                                    {if $type == 1}
                                    <option value="1">普通用户</option>
                                    <option value="3">商家</option>
                                    <option value="4">客户</option>
                                    <option value="5">业务员</option>
                                    {/if}
                                    {if $type == 2}
                                    <option value="3">商家</option>
                                    {/if}
                                    {if $type == 3}
                                    <option value="4">客户</option>
                                    {/if}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="wk.layer_close('close')">关闭
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
</body>
</html>
<script>
    wk.uploadImg({size: 5, type: 'png,jpg,jpeg', url: "{:url('Upload/upload')}", domain: ""});
    layui.use(['form', 'upload', 'layedit'], function () {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            $('.layui-btn').addClass('layui-disabled').attr('disabled', 'disabled');
            $.ajax({
                url: "{:url('newAdd')}",
                type: 'post',
                dataType: 'json',
                data: data.field,
                success: function (res) {
                    if (res.code == 200) {
                        layer.msg(res.msg, {icon: 1, time: 1500, shade: 0.1}, function (index) {
                            wk.layer_close();
                        })
                    } else {
                        wk.error(res.msg, '', '$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });
    });
</script>